import 'package:flutter/cupertino.dart';

/**
 *
 * @ProjectName:    package_model
 * @ClassName:      base_adapter
 * @Description:    dart类作用描述
 * @Author:         孙浩
 * @QQ:             243280864
 * @CreateDate:     2021/1/31 11:34 PM
 */
abstract class BaseAdapter<T> extends StatelessWidget {
  int index;
  T data;
  ValueChanged<int> onItemClick;

  BaseAdapter(this.index, this.data, {this.onItemClick});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        onItemClick.call(index);
      },
      child: buildChild(data),
    );
  }

  buildChild(T data);
}
